<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div class="login">
        <label for="">
            <img src="test_1.png" alt="" id="test">
        </label>
        <input type='password' id="psw">
    </div>

    <script>
        var test = document.getElementById('test')
        var psw = document.getElementById('psw')
        var flag = 0;
        test.onclick = function () {
            if (flag == 0) {
                psw.type = 'text'
                test.src = 'test.png'
                flag = 1
            } else {
                psw.type = 'password'
                test.src = 'test_1.png'
                flag = 0;
            }
        }
    </script>
</body>

</html>